import { UserInfo } from "@/types/user"
const USERINFO_KEY = 'rabbit-userInfo'
// 储存用户信息
export const setUserInfo = (userInfo: UserInfo, name: string = USERINFO_KEY) => {
  localStorage.setItem(name, JSON.stringify(userInfo))
}
// 获取用户信息
export const getUserInfo = (name: string = USERINFO_KEY): UserInfo => {
  return JSON.parse(localStorage.getItem(name) as string) || {} as UserInfo
}
// 删除用户信息
export const removeUserInfo = (name: string = USERINFO_KEY) => {
  localStorage.removeItem(name)
}
